<?php
include_once("../../../config.php");

//$_REQUEST['data'][0];
//$_REQUEST['group_tag2'];
//$_REQUEST['group_tag3'];
$member=$_REQUEST['Authorization'];



//先删除,所有审核仲的？
//$del_sql="delete from ".$table_prefix."member_group where member_nid = '".$member."'";


//如果有审核中的标签，就不能修改
//$now_tag    =select_one_line_all_items($table_prefix."member_group","","member_nid = '$member'","");


//因为审核中可以修改，所以要把已经通过的标签，
//$tag_status =transform_2darray_in_1darray_number_as_key($now_tag,"status");

//处理三个传递过来的数据，旧数据是中文就剔除



if(!$_REQUEST['group_tag1_status'] and $_REQUEST['group_tag1'])
{
$new_data[1]['0member_nid'] = $_REQUEST['Authorization'];
$new_data[1]['1group_nid']  = $_REQUEST['group_tag1'];
$new_data[1]['2status']     = "申请中";
$new_data[1]['3add_time']   = date("Y-m-d H:i:s");
}
if(!$_REQUEST['group_tag2_status'] and $_REQUEST['group_tag2'])
{$new_data[2]['0member_nid'] = $_REQUEST['Authorization'];
$new_data[2]['1group_nid']  = $_REQUEST['group_tag2'];
$new_data[2]['2status']     = "申请中";
$new_data[2]['3add_time']   = date("Y-m-d H:i:s");
}
if(!$_REQUEST['group_tag3_status'] and $_REQUEST['group_tag3'])
{
    $new_data[3]['0member_nid'] = $_REQUEST['Authorization'];
$new_data[3]['1group_nid']  = $_REQUEST['group_tag3'];
$new_data[3]['2status']     = "申请中";
$new_data[3]['3add_time']   = date("Y-m-d H:i:s");
}

$p['table']=$table_Prefix."member_group";
$p['items']=array("member_nid","group_nid","status","add_time");
$p['values']=$new_data;

$creat_sql=insert_datas($p);
$result = do_query($creat_sql);
mysqli_close($con);

if(!$result)
{
    $data          = "插入成功";
}
else
{
    $data          = $result;
}



$arr['status'] = 200;
$arr['info']   = $data;
die(json_encode($arr));
?>